<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/base.jsp"%>
<%@ include file="/module/taglibs.jsp"%>
<%@ include file="/module/nocache.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>管理公告公示</title>
<%@ include file="/module/js.jsp"%>
</head>
<body>
	<form action="#" name="Form" id="Form" method="post">
	<%--     <input type="hidden" name="projectId" id="projectId"  value="${projectId}"/> --%>
		<input type="hidden" name="idList" id="idList"/>
		<input type="hidden" id="bodyData" name="bodyData" value=""/>
		<table cellpadding="1" cellspacing="1" border="0">
			 <c:if test="${_login_user_type==2}">
			<tr>
				<td><input type="button" id="btnQuery" value="查询"
					class="inputButton" />        
			    </td>
				<td>
				<kl:permission permisstionList="${permisstionList}"
                    currentUser="${_login_console_user}"
                    currentCatalogId="<%=CatalogUtils.getCatalogId(\"ZHDJ_DJZX_DJZX\")%>" key="add">
                     <input type="button" id="btnAdd" value="添 加" class="inputButton" />
                 </kl:permission>
			    </td>
				<td>
			<kl:permission permisstionList="${permisstionList}"
                    currentUser="${_login_console_user}"
                    currentCatalogId="<%=CatalogUtils.getCatalogId(\"ZHDJ_DJZX_DJZX\")%>" key="add"> 
                     <input type="button" id="btnDelete" value="删除" class="inputButton" />
                  </kl:permission>
			    </td>
				<td><input type="button" id="btnExport" value="导出"
					 class="inputButton"/></td>
			</tr>
		 </c:if>
		</table>
		<br />
	   <table cellpadding="1" cellspacing="1">
			<tr>
			    <td>是否置顶：</td>
				<td align="left"><select id="onTop" name="onTop" class="selectList2">
						<option value="">全部</option>
						<option value="0">是</option>
						<option value="1">否</option>
				</select></td>
				 <td>发布状态：</td>
				<td align="left"><select id="issued" name="issued" class="selectList2">
						<option value="">全部</option>
						<option value="0">已发布</option>
						<option value="1">未发布</option>
				</select></td>
				<td>标题：</td>
				<td><input type="text" name="subject" id="subject"   autocomplete="off" class="inputText2" /></td>
			</tr>
		</table>
		<br />	
	<table id="dg"  style="width:100%;"
		data-options="pagination:true,collapsible:true,url:'${basePath}/partyNotice/getListData',method:'post',remoteSort:true">
		<thead>
			<tr>
				<th data-options="field:'gGID',checkbox:true,width:60,align:'center'"></th>
			    <th data-options="field:'subject',sortable:true,nowrap:true,width:300,align:'center',formatter:formater">标题</th>
				<th data-options="field:'onTop',sortable:true,nowrap:true,width:100,align:'center',formatter:onTop">是否置顶</th>
				<th data-options="field:'issued',sortable:true,nowrap:true,width:100,align:'center',formatter:issued">是否发布</th>
				<th data-options="field:'isImgLink',sortable:true,nowrap:true,width:100,align:'center',formatter:isImgLink">是否图片链接</th>
				<th data-options="field:'creatorName',sortable:true,nowrap:true,width:300,align:'center'">创建人</th>
			    <th data-options="field:'createTime',sortable:true,nowrap:true,width:200,align:'center',formatter:formatDate">创建时间</th>
			</tr>
		</thead>
	</table>
	</form>
    <script>
	    function formatDate(value){
	    	var date=new Date(value);
			var y = date.getFullYear();
			var m = date.getMonth()+ 1;
			var d = date.getDate();
			var h= date.getHours();       //获取当前小时数(0-23)
			var mm= date.getMinutes();     //获取当前分钟数(0-59)
			var s= date.getSeconds();     //获取当前秒数(0-59)
			return y +'-'+(m <10?('0'+ m):m)+'-'+(d <10?('0'+ d):d)+' :'+(h <10?('0'+ h):h)+':'+(mm <10?('0'+ mm):mm)+':'+(s <10?('0'+ s):s);
		}
    
    
		function formater(value, row, index) {
			return "<a href='${basePath}/partyNotice/view?gGID=" + row.gGID + "'>" + row.subject + "</a>";
		}
		function onTop(value, row, index) {
			if(row.onTop == '0') {
				 return "是"; 						 
			 } else if(row.onTop == '1') {
				 return "否";
			 }
		}		
		function issued(value, row, index) {
			if(row.issued == '0') {
				 return "是"; 						 
			 } else if(row.issued == '1') {
				 return "否";
			 }
		}
		function isImgLink(value, row, index) {
			if(row.isImgLink == '0') {
				 return "否"; 						 
			 } else if(row.isImgLink == '1') {
				 return "是";
			 }
		}
     </script>
  
	
		 <script type="text/javascript">
			
			$(document).ready(function() {
				
	            $('#dg').datagrid({
				   rowStyler: function(index,row){
				   },
				   onLoadSuccess : function(data) {//加载完毕后获取所有的checkbox遍历
						if (data.rows.length > 0) {
						}
					},
				});
									
				$('#btnAdd').click(function() {
					   window.location.href = "${basePath}/partyNotice/add";
				});
					//查询
				$('#btnQuery').click(function() {
					$('#dg').datagrid('load',{
						onTop : $('#onTop').val(),
						issued : $('#issued').val(),
						subject : $('#subject').val()
					});
				});
				// 删除
				$('#btnDelete').click(function() {
				    	$("#idList").val("");
					    var count = 0;
						var idList = new Array();
					    var sels = $("#dg").datagrid("getSelections");
				    	for(var i in sels){
				    		idList.push(sels[i].gGID);
				    		count++;
				    	}
						if (count == 0) {
							layer.alert("您至少选择一条删除记录信息", {icon: 3});
							return false;
						}else{
							  layer.confirm("您是否删除当前选中数据信息", {icon: 3, title:'提示',skin:'layer-ext-moon'}, function(index){
								    $("#idList").val(idList);
								    document.Form.action = "${basePath}/partyNotice/delete";
									document.Form.submit();
							  },function(index){
									layer.close(index);
							  });
						}
					});
		     	});
				$('#btnExport').on('click', function(){
					   layer.confirm("您确定要导出吗?", {icon: 3, title:'提示',skin:'layer-ext-moon'}, function(index){
							    document.Form.action = "${basePath}/partyNotice/export_partyNotice";
								document.Form.submit();
								layer.close(index);
	            		 });
					});
				
	</script>
</body>
</html>
